<template>
	<view>
		<view class="content" >
		         <!-- <div class="mui-content-padded">
					<cc-listView :productList="projectList" @click="goProDetail"></cc-listView>
				</div> -->
				
				<view class="uni-list-cell" hover-class="uni-list-cell-hover" v-for="(item, index) in approveList"
					:key="item.id" @click="goProDetail(item)">
					<view class="cu-form-group-ccl" >
						<view style="display: flex; flex: 1; flex-wrap: wrap; margin-top: 0px; margin-left: -8px; height: 38px; width:calc(100vw-62px)">
							<view class="cellView" :style="{ color: bindColor(item), backgroundColor: bindBgColor(item) }">
								{{bindTag(item)}}
							</view>
						</view>
						<view class="topTitleV unitV">{{item.submissionTime}}</view>
					</view>
					
					<view class="topTitleV" style="margin-left: 10px;">
						{{item.fromName}}
					</view>
				</view>
				
				
		</view>
	</view>
</template>

<script>
	import ccListView from '../../uni_modules/cc-listView/components/cc-listView/cc-listView.vue'
	import common from '../../common/common.js';
	import request from '../../common/request';
	export default {
		components: {
			ccListView
		},
		data() {
			return {
				// TabCur: 0,
				// scrollLeft: 0,
				 // 列表数组
				  approveList: [],
				  staff:{},
				// modules:[
				// 	{"name": "待处理"},
				// 	{"name": "已处理"},
				// 	{"name": "抄送我"},
				// ],
			};
		},
		onLoad() {
			this.staff = uni.getStorageSync("staff");
			console.log(this.staff);
		    this.requestData();
		},
		methods: {
			goProDetail(item) {
				uni.navigateTo({
					url:'/pages/examine/approvalPage?fromId=' + item.fromId + '&status=1'
				})
			},
			requestData() {
				request({
					url: common.base_url +'/system/form/ApprovalRecord',
					data:{
					},
					header:{
					},
					method: 'GET',
					success: res => {
						if(res.data.code == 200){
							console.log(res)
							this.approveList = res.data.data;
							
						} else{
							uni.showToast({
								title: res.data.msg,
								icon:"error"
							})
						}
					},
					fail: function(e) {
						uni.hideLoading();
						uni.showToast({
							title:"唉哟，程序错误了["+JSON.stringify(e.msg)+"],请联系管理员",
							icon:"loading"
						})
					},
				});
			},
			bindTag(item) {
				/** 申请单状态  0-待审核  3-审核未通过 1-审核通过 2-审核中 */
				if(item.status == 0){
					return "待审核";
				} else if (item.status == 1){
					return '审核通过';
				}else if (item.status == 2){
					return '审核中';
				}else if (item.status == 3){
					return '审核未通过';
				}
				// return [item.area, item.proType, item.status]
			},
			bindColor(item) {
				if(item.status == 0){
					return '#888481';
				} else if (item.status == 1){
					return '#3bb100';
				}else if (item.status == 2){
					return '#55aaff';
				}else if (item.status == 3){
					return '#ff0000';
				}
				// let colorArr = ['#4473FF', '#FFA01B', '#41D380'];
				// return colorArr[index % 3];
			},
			bindBgColor(item) {
				// if(item.status == 0){
				// 	return '#F1F4FA';
				// } else if (item.status == 1){
				// 	return '#ff0000';
				// }else if (item.status == 3){
				// 	return '#55ffff';
				// }else if (item.status == 4){
				// 	return '#5555ff';
				// }
			},
		}
	}
</script>

<style scoped>

	
	.cu-form-group-ccl {
		background-color: #ffffff;
		padding: 1upx 20upx;
		display: flex;
		align-items: center;
		min-height: 100upx;
		justify-content: space-between;
	}
	
	
	.uni-list-cell {
		flex-direction: column;
		margin-top: 10px;
		background-color: white;
		padding: 6px 12px;
	
	
	}
	
	.topTitleV {
	
		height: 26px;
		line-height: 26px;
		color: #333333;
		font-family: PingFangSC-Semibold, PingFang SC;
		font-weight: 500;
		font-size: 14px;
		
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	
	}
	.unitV{
		color: #555555;
		font-size: 12px;
		margin-top: 0px;
		font-family: PingFangSC-Regular, PingFang SC;
		
	}
	
	.cellView {
		margin-top: 8px;
		margin-left: 8px;
		height: 22px;
		line-height: 22px;
		text-align: center;
		border-radius: 2px;
		padding: 0px 4px !important;
		font-size: 12px;
	
		color: #4272FF;
		background: #F3F4F6;
	}
	

</style>
